package com.pw.study.flink.transfrom

import com.pw.study.flink.source.{WordBean, WordSource}
import org.apache.flink.api.java.tuple.Tuple
import org.apache.flink.streaming.api.scala._

/**
 * @Desc: TODO
 * @author: future
 * @since: 2022/5/15-10:26
 */
object MyKeyBy {
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1)
    val ds = env.addSource(new WordSource())
    val dsWord: KeyedStream[WordBean, String] = ds.keyBy(_.word)
    val dsField: KeyedStream[WordBean, Tuple] = ds.keyBy("word")
    ds.print()
    dsWord.print("word:->keyBy")
    dsField.print("keyBy->Field")



    env.execute("jobName: ")
  }
}
